#include "aky_com_include.h"

uint32_t rcc_sys_clc = 0;

void aky_rcc_init(void)
{
		//==== system clk setting ====
		CLKSEL = 0x07;								// set Fcpu = Fhosc/1		(32M Hz)		 
																	//7..3	Reserved    		0x00
																	//2..0	CLKSEL[2:0]			
																					//111		CLKSEL would be applied by writing CLKCMD. 
																					//000: fcpu = fosc / 128
																					//001: fcpu = fosc / 64
																					//010: fcpu = fosc / 32
																					//011: fcpu = fosc / 16
																					//100: fcpu = fosc / 8
																					//101: fcpu = fosc / 4
																					//110: fcpu = fosc / 2
																					//111: fcpu = fosc / 1
	
		CLKCMD = 0x69;								// Apply CLKSEL s setting
		CKCON  = 0x10;								// 2 times //ROM Delay 2 (Fcpu = 32M / 2)

		P2M  &=	~(0x03); //晶振引脚输入
		P2UR  &= ~(0x03);

}
